import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flutter_flame/worlds/game/components/NormalZombie.dart';
import 'package:flutter_flame/worlds/game/components/bullet/Cabbage.dart';
import 'package:flutter_flame/worlds/game/components/plants/CommonPlant.dart';

import '../../entity/SpriteAnimationParamEntity.dart';
import '../../model/PlantModel.dart';

// 包心菜投手
class Cabbagepult extends CommonPlant {
  Cabbagepult({
    required super.cell,
  }) : super(
          idleEntity: SpriteAnimationParamEntity.cabbagepultIdle,
          attackEntity: SpriteAnimationParamEntity.cabbagepultShoot,
          plantModel: PlantModel.cabbagepult,
          shootDelayTime: Duration(milliseconds: 500),
        );

  @override
  Future<void> attack(NormalZombie zombie) {
    world.add(Cabbage(
      position: position + Vector2(10, -35),
      targetZombie: zombie,
    ));
    return super.attack(zombie);
  }
}
